package com.ruoyi.my.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.my.domain.GrHomeInfo;
import com.ruoyi.my.mapper.GrHomeInfoMapper;
import com.ruoyi.my.service.IGrHomeInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 房屋Service业务层处理
 *
 * @author liuxusheng
 * @date 2022-01-05
 */
@Service
public class GrHomeInfoServiceImpl implements IGrHomeInfoService {
    @Autowired
    private GrHomeInfoMapper grHomeInfoMapper;

    /**
     * 查询房屋
     *
     * @param id 房屋主键
     * @return 房屋
     */
    @Override
    public GrHomeInfo selectGrHomeInfoById(Long id) {
        return grHomeInfoMapper.selectGrHomeInfoById(id);
    }

    /**
     * 查询房屋列表
     *
     * @param grHomeInfo 房屋
     * @return 房屋
     */
    @Override
    public List<GrHomeInfo> selectGrHomeInfoList(GrHomeInfo grHomeInfo) {
        return grHomeInfoMapper.selectGrHomeInfoList(grHomeInfo);
    }

    /**
     * 新增房屋
     *
     * @param grHomeInfo 房屋
     * @return 结果
     */
    @Override
    public int insertGrHomeInfo(GrHomeInfo grHomeInfo) {
                grHomeInfo.setCreateTime(DateUtils.getNowDate());
            return grHomeInfoMapper.insertGrHomeInfo(grHomeInfo);
    }

    /**
     * 修改房屋
     *
     * @param grHomeInfo 房屋
     * @return 结果
     */
    @Override
    public int updateGrHomeInfo(GrHomeInfo grHomeInfo) {
                grHomeInfo.setUpdateTime(DateUtils.getNowDate());
        return grHomeInfoMapper.updateGrHomeInfo(grHomeInfo);
    }

    /**
     * 批量删除房屋
     *
     * @param ids 需要删除的房屋主键
     * @return 结果
     */
    @Override
    public int deleteGrHomeInfoByIds(Long[] ids) {
        return grHomeInfoMapper.deleteGrHomeInfoByIds(ids);
    }

    /**
     * 删除房屋信息
     *
     * @param id 房屋主键
     * @return 结果
     */
    @Override
    public int deleteGrHomeInfoById(Long id) {
        return grHomeInfoMapper.deleteGrHomeInfoById(id);
    }
}
